<?php
/**
* Save dictionary word
* @author trungdt
* @since Aug 8
* 
*/

if (!defined('EXPONENT')) exit('');

$link = null;
if (isset($_POST['id'])) {
	$link = $db->selectObject('gbible_dic','id='.intval($_POST['id']));
}

if (($link && exponent_permissions_check('edit',$loc)) || (!$link && exponent_permissions_check('create',$loc))) {
	$link = dicmodule_dic::update($_POST,$link);
	$link->location_data = serialize($loc);
    
    if (isset($link->location_data))
        unset($link->location_data);
    
	if (isset($link->id)) {
		$db->updateObject($link,'gbible_dic');
	} else {
		$db->insertObject($link,'gbible_dic');
	}
	exponent_flow_redirect();
} else {
	echo SITE_404_HTML;
}

?>